package com.javaframe.role.security;

import org.acegisecurity.GrantedAuthority;
import org.acegisecurity.userdetails.User;



/**
 * The class <code>UserDetailsImpl</code> extends the
 * org.acegisecurity.userdetails.User class, and provides additional userId,
 * companyId information
 * 
 * @see IUserDetails, User
 */
public class UserDetailsImpl extends User implements IUserDetails {
	
	private int user_id;
	private String username;
	private String password;
	private GrantedAuthority[] authorities;

	public UserDetailsImpl(String username, String password, boolean enabled,
			boolean accountNonExpired, boolean credentialsNonExpired,
			boolean accountNonLocked, GrantedAuthority[] authorities)
			throws IllegalArgumentException {
		super(username, password, enabled, accountNonExpired,
				credentialsNonExpired, accountNonLocked, authorities);
		setUsername(username);
		setPassword(password);
		setAuthorities(authorities);
	}

	public UserDetailsImpl(int userid, int companyid, String username,
			String password, String impowerid, String corpname, boolean enabled,
			boolean accountNonExpired, boolean credentialsNonExpired,
			boolean accountNonLocked, GrantedAuthority[] authorities)
			throws IllegalArgumentException {
		super(username, password, enabled, accountNonExpired,
				credentialsNonExpired, accountNonLocked, authorities);
		this.user_id = userid;
		setUsername(username);
		setPassword(password);
		setAuthorities(authorities);
	}

	public int getUserId() {
		return user_id;
	}

	public void setUserId(int user_id) {
		this.user_id = user_id;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public GrantedAuthority[] getAuthorities() {
		return authorities;
	}

	public void setAuthorities(GrantedAuthority[] authorities) {
		this.authorities = authorities;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getPassword() {
		return this.password;
	}
}
